package com.sgcc.ln.pmos.e_ln_order.adapter;


import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sgcc.ln.pmos.common.utils.BigDecimalUtils;
import com.sgcc.pmos.nativesdk.R;
import com.sgcc.ln.pmos.e_ln_order.bean.ContractElectricityBean;

/**
 * 约定电量
 */
public class ConventionPowerAdapter extends BaseQuickAdapter<ContractElectricityBean, BaseViewHolder> {

    public ConventionPowerAdapter() {
        super(R.layout.item_conventionpower);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ContractElectricityBean bean) {
        baseViewHolder.setText(R.id.tv_top, bean.getPeriod());

        baseViewHolder.setText(R.id.tv_center, BigDecimalUtils.onKeep3Decimal(bean.getOld_ele()));
        if (TextUtils.isEmpty(bean.getNew_ele())) {
            baseViewHolder.setGone(R.id.rl_bottom, true);
        } else {
            baseViewHolder.setGone(R.id.rl_bottom, false);
        }
        baseViewHolder.setText(R.id.tv_bottom, BigDecimalUtils.onKeep3Decimal(bean.getNew_ele()));
    }


}
